package com.hz.framework.util;

import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * @author zhaoliangyuan
 * @E-mail zhao19860603@163.com
 * @dateTime 2010/6/30 上午 11:29:44 类说明:
 * java 抓取页面信息
 */
public class LabelValue {

	public static String getHtmlReadLine(String httpurl){

		String CurrentLine="";

		String TotalString="";

		InputStream urlStream;

		String content="";

		try {

			URL url = new URL(httpurl);

			HttpURLConnection connection = (HttpURLConnection)url.openConnection();

			connection.connect();

			urlStream = connection.getInputStream();

			BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream,"utf-8"));

			while ((CurrentLine = reader.readLine()) != null) {
				TotalString += CurrentLine+"\n";
				/** 换行的地方主要是在这里* */
			}
			content = TotalString;
		} catch (Exception e) {

			e.printStackTrace();

		}

		return content;
	}

	public static void main(String[] args) {
		String s = getHtmlReadLine("http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx/getRegionProvince");
		System.out.println(s);
	}
}